refactor(mcp): 디버그 대시보드 사용자 URL을 /attach?u= 에서 루트 /로 수렴 (#595)#598
Merged
Conversation
buildAttachPageUrl이 반환하는 사용자 대면 URL을 http://127.0.0.1:<port>/attach?u=<encoded> 에서 http://127.0.0.1:<port>/ (루트, server-state 렌더)로 변경한다. 같은 MCP 데몬이 attachUrl을 이미 in-memory로 보유하므로 ?u= 쿼리는 redundant하고, TOTP at=·tunnel host가 주소창/ 히스토리에 남는 시크릿 노출 표면이었다. - qr-http-server.ts: buildAttachPageUrl이 루트 / 반환 - tools.ts: OpenQrInBrowserResult.httpUrl 설명 + JSDoc 업데이트 - /attach?u= 라우트는 back-compat으로 유지 (기존 링크 보호) - 테스트: buildAttachPageUrl 루트 URL 검증 + 새 시크릿 격리 assert → /attach?u= 라우트를 직접 URL로 검증하는 테스트는 유지
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
개요
build_attach_urlMCP 도구가 브라우저로 여는(그리고 사용자에게 인쇄하는) URL을http://127.0.0.1:<port>/attach?u=<intoss-private deep-link 인코딩>에서http://127.0.0.1:<port>/(루트, server-state 렌더)로 수렴한다.Closes #595
변경 내용
핵심 변경
src/mcp/qr-http-server.ts—buildAttachPageUrl이 루트/URL을 반환하도록 변경._attachUrl인자는 여전히 받되(인터페이스 호환), server-state(getDashboardState)에서 파생하므로 무시. 주석으로 이유와 SECRET-HANDLING 명시.src/mcp/tools.ts—OpenQrInBrowserResult.httpUrl설명 +openQrInBrowserJSDoc을 루트 URL 기준으로 갱신.유지된 것
/attach?u=라우트 자체는 back-compat으로 그대로 유지(기존 인쇄된 링크/QR 보호)./qr.png?u=(stateless 이미지 헬퍼) — 변경 없음.pngUrl은 여전히?u=사용.tunnel.ts의startTunnelDashboard— 이미 루트 URL 사용 중이었으므로 변경 불필요.보안 개선
이 변경으로 브라우저 주소창·히스토리에서 다음이 제거됨:
at=코드 값*.trycloudflare.com)QR 이미지 안에는 여전히 deep-link가 들어가지만, 폰이 스캔하는 데 필요하고 주소창에는 안 남는다.
검증 결과
pnpm build✅pnpm typecheck✅pnpm lint✅ (errors 0)pnpm test✅ (91 passed, 1 skipped)check:mcp-react-free✅ (cli.js, server.js 모두 react-free)check:dashboard-html-fresh✅ (dashboard.generated.ts 최신)테스트 변경
qr-browser.test.ts:buildAttachPageUrl테스트를 루트 URL 검증으로 교체. 새 테스트 추가: httpUrl이/이고?u=/at=를 포함하지 않음을 assert.qr-http-server.test.ts:buildAttachPageUrl사용 테스트들을/attach?u=직접 URL로 교체 (back-compat 라우트 검증 유지).UI 회귀 검증
루트
/대시보드는 기존에도buildDashboardHtml(server-state 렌더)로 서빙되어 SSE self-refresh·QR·inspector 섹션이 완비되어 있다.env 2(startTunnelDashboard)도 이미 루트를 사용 중이었으므로 회귀 없음. 수동 대시보드 시각 검증은 메인 세션에서.SECRET-HANDLING 준수
http://127.0.0.1:<port>(루트, 쿼리 없음)만.at=코드는 QR 이미지·SSE payload·/qr.png?u=query 안에만.